package com.yige.service;

import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

import java.util.List;

/**
 * Created by sunhao on 2015/9/22 0022.
 */
public interface BasicMongoService {

    /**查询所有文档*/
    List<DBObject> findList();

    /**根据条件查询文档*/
    List<DBObject> findListByQuery(BasicDBObject query);

    /**date值降序查询*/
    List<DBObject> findListByQueryDesDate(BasicDBObject query);

    /**date值降序查询文档*/
    List<DBObject> findListDescendingByDate();

    /**date值升序查询文档*/
    List<DBObject> findListAscendingByDate();

    /**根据id查找文档*/
    DBObject findOneById(Object _id);

    /**根据名称查询单个文档*/
    DBObject findOneByQuery(BasicDBObject query);

    /**插入文档*/
    boolean insertOne(DBObject dbObject);

    /**修改文档*/
    boolean updateOne(Object _id, DBObject dbObject);

    /**删除文档*/
    boolean deleteOne(Object _id);

    /**清空集合*/
    boolean removeCollection();

}
